home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kguiitem.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-01-19  |  3.1 KB  |  99 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 2001 Holger Freyther (freyher@yahoo.com)
  3.                   based on ideas from Martijn and Simon
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License version 2 as published by the Free Software Foundation.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.     Boston, MA 02110-1301, USA.
  18.  
  19.     Many thanks to Simon tronical Hausmann
  20. */
  21.  
  22. #ifndef __kguiitem_h__
  23. #define __kguiitem_h__
  24.  
  25. #include <qstring.h>
  26. #include <qiconset.h>
  27. #include <qpixmap.h>
  28. #include <qvaluelist.h>
  29. #include <kicontheme.h>
  30. #include <kglobal.h>
  31.  
  32. /**
  33.  * @short An abstract class for GUI data such as ToolTip and Icon.
  34.  *
  35.  * @author Holger Freyther <freyher@yahoo.com>
  36.  * @see KStdGuiItem
  37.  */
  38. class KDEUI_EXPORT KGuiItem
  39. {
  40. public:
  41.     KGuiItem();
  42.  
  43.     // ### This should probably be explicit in KDE 4; it's easy to get
  44.     // subtle bugs otherwise - the icon name, tooltip and whatsthis text
  45.     // get changed behind your back if you do 'setButtonFoo( "Bar" );'
  46.     // It gives the wrong impression that you just change the text.
  47.     KGuiItem( const QString &text, 
  48.               const QString &iconName  = QString::null,
  49.               const QString &toolTip   = QString::null, 
  50.               const QString &whatsThis = QString::null );
  51.  
  52.     KGuiItem( const QString &text, const QIconSet &iconSet, 
  53.               const QString &toolTip   = QString::null, 
  54.               const QString &whatsThis = QString::null );
  55.  
  56.     KGuiItem( const KGuiItem &rhs );
  57.     KGuiItem &operator=( const KGuiItem &rhs );
  58.  
  59.     ~KGuiItem();
  60.  
  61.     QString text() const;
  62.     QString plainText() const;
  63. #ifndef KDE_NO_COMPAT
  64.     QIconSet iconSet( KIcon::Group, int size = 0, KInstance* instance = KGlobal::instance()) const;
  65.     QIconSet iconSet() const { return iconSet( KIcon::Small ); }
  66. #else
  67.     QIconSet iconSet( KIcon::Group=KIcon::Small, int size = 0, KInstance* instance = KGlobal::instance()) const;
  68. #endif
  69.  
  70.     QString iconName() const;
  71.     QString toolTip() const;
  72.     QString whatsThis() const;
  73.     bool isEnabled() const;
  74.     /**
  75.      * returns whether an icon is defined, doesn't tell if it really exists
  76.      */
  77.     bool hasIcon() const;
  78. #ifndef KDE_NO_COMPAT
  79.     bool hasIconSet() const { return hasIcon(); }
  80. #endif
  81.  
  82.     void setText( const QString &text );
  83.     void setIconSet( const QIconSet &iconset );
  84.     void setIconName( const QString &iconName );
  85.     void setToolTip( const QString &tooltip );
  86.     void setWhatsThis( const QString &whatsThis );
  87.     void setEnabled( bool enable );
  88.  
  89. private:
  90.     class KGuiItemPrivate;
  91.     KGuiItemPrivate *d;
  92. };
  93.  
  94. /* vim: et sw=4
  95.  */
  96.  
  97. #endif
  98.  
  99.